home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
651-660
/
658
/
skew
/
source
/
skew1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-15
|
44KB
|
1,403 lines
/*
* skew1.c
*
* PROGRAM NAME: SKEW ( meaning "SKEleton Writer" )
*
* VERSION: 0.85
*
* FINISHED: 11-Mar-92
*
* PURPOSE: Utility for generating GetIDCMP() functions & Co.
*
* PROGRAMMER: Piotr Obminski
*
* LEGAL STATUS: Public Domain
*
* COMPILER: DICE V2.06
*
* COMPILATION: dmake -f skew.make
*
* COMMENTS: My first biggish Amiga C project...
*
* HISTORY: See file skew.history
*/
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include "skew.h"
#include "image.h"
APTR GadToolsBase = NULL;
APTR AslBase = NULL;
struct Window *Wnd = NULL;
struct Screen *Scr = NULL;
APTR VisualInfo = NULL;
struct TextAttr topaz8 = {
( STRPTR )"topaz.font", 8, 0x00, 0x01 };
/* Colors1 -- white coffe, black, white & red */
struct ColorSpec ScreenColors[] = {
0, 0x0B, 0x0A, 0x09,
1, 0x00, 0x00, 0x02,
2, 0x0F, 0x0F, 0x0F,
3, 0x09, 0x01, 0x00,
~0, 0x00, 0x00, 0x00 };
UWORD DriPens[] = {
0,1,1,2,1,3,1,0,2,~0 };
struct TagItem ScreenTags_PAL[] = {
SA_Left, 0,
SA_Top, 0,
SA_Width, 640,
SA_Height, 256,
SA_Depth, 2,
SA_Colors, ScreenColors,
SA_Font, &topaz8,
SA_Type, CUSTOMSCREEN,
SA_DisplayID, PAL_MONITOR_ID | HIRES_KEY,
SA_Pens, DriPens,
TAG_DONE };
/* what a waste! */
struct TagItem ScreenTags_NTSC[] = {
SA_Left, 0,
SA_Top, 0,
SA_Width, 640,
SA_Height, 256,
SA_Depth, 2,
SA_Colors, ScreenColors,
SA_Font, &topaz8,
SA_Type, CUSTOMSCREEN,
SA_DisplayID, NTSC_MONITOR_ID | HIRESLACE_KEY,
SA_Pens, DriPens,
TAG_DONE };
struct TagItem WindowTags[] = {
WA_Left, 2,
WA_Top, 10,
WA_Width, 637,
WA_Height, 246,
WA_IDCMP, IDCMP_GADGETDOWN | IDCMP_GADGETUP |
IDCMP_REFRESHWINDOW | IDCMP_MENUPICK,
WA_Flags, WFLG_SMART_REFRESH | WFLG_ACTIVATE | WFLG_RMBTRAP |
WFLG_BACKDROP,
WA_Gadgets, 0L,
WA_Title, NULL,
WA_ScreenTitle,
"SKEleton Writer Public Domain by Piotr Obminski March 1992",
WA_CustomScreen, 0L,
WA_MinWidth, 637,
WA_MinHeight, 1,
WA_MaxWidth, 637,
WA_MaxHeight, 246,
TAG_DONE };
struct IntuiText IText1[]= {
3, 0, JAM2, 588, 12, &topaz8, (UBYTE *)"1/3", &IText1[1],
3, 0, JAM1, 60, 135, &topaz8, (UBYTE *)"Fields in IntuiMessage:", NULL };
struct IntuiText IText2[] = {
3, 0, JAM2, 588, 12, &topaz8, (UBYTE *)"2/3", &IText2[1],
3, 0, JAM1, 80, 20, &topaz8, (UBYTE *)"Class:", NULL };
struct IntuiText IText3[] = {
3, 0, JAM2, 588, 12, &topaz8, (UBYTE *)"3/3", &IText3[1],
3, 0, JAM1, 60, 20, &topaz8, (UBYTE *)"Global options:", NULL };
/* stuff related to displaying program's logo */
extern UWORD Title_data[];
/* IMAGE STRUCTURE */
struct Image Title = {
0, 0, 477, 40, 2, &Title_data[0], 2, 0, NULL };
int Display_num;
/* stuff for top-level function name */
char *TOP_LEVEL_BUF;
char TOP_LEVEL_NAME[ 40 ] = "GetIDCMP";
/* stuff for IDCMPWindow name */
char *IDCMP_WIN_BUF;
char IDCMP_WIN_NAME[ 40 ] = "Wnd";
/* prefix & suffix for the names of the generated functions */
char *PREFIX_BUF, *SUFFIX_BUF;
char PREFIX_NAME[ 20 ], SUFFIX_NAME[ 20 ];
extern struct Gadget *GList;
extern struct Gadget *Gadgets[];
/* flags related to gadgets & output file */
extern long Flag1;
extern long Flag2A;
extern long Flag2B;
extern long Flag3;
/* flags for cycle gadgets on display #3 */
extern int WaitingMode_FLAG, Variables_FLAG, Comments_FLAG, FillIns_FLAG,
WaitingMode_START, Variables_START, Comments_START, FillIns_START;
/* stuff needed for cycle gadgets in last (third) display */
UBYTE *WaitingModeLabels0[] = {
"passive",
"busy",
0L };
UBYTE *WaitingModeLabels1[] = {
"busy",
"passive",
0L };
UBYTE *VariablesLabels0[] = {
"global",
"local",
0L };
UBYTE *VariablesLabels1[] = {
"local",
"global",
0L };
UBYTE *CommentsLabels0[] = {
"sparse",
"NONE",
"verbose",
0L };
UBYTE *CommentsLabels1[] = {
"NONE",
"verbose",
"sparse",
0L };
UBYTE *CommentsLabels2[] = {
"verbose",
"sparse",
"NONE",
0L };
UBYTE *FillInsLabels0[] = {
"NOT MARKED",
"@@@@@@@@@@",
"/* @@ */",
"@@",
0L };
UBYTE *FillInsLabels1[] = {
"@@@@@@@@@@",
"/* @@ */",
"@@",
"NOT MARKED",
0L };
UBYTE *FillInsLabels2[] = {
"/* @@ */",
"@@",
"NOT MARKED",
"@@@@@@@@@@",
0L };
UBYTE *FillInsLabels3[] = {
"@@",
"NOT MARKED",
"@@@@@@@@@@",
"/* @@ */",
0L };
/* function prototypes */
void main( void );
static long InitStuff( void );
static long MakeWindow( void );
void CleanStuff( void );
long MakeDisplay( int num );
extern void HandleIDCMP( void );
extern void HandleGadgets( USHORT, APTR );
void main( void )
{
if ( InitStuff() != 0L ) {
exit( 25 );
};
HandleIDCMP();
CleanStuff();
}
long InitStuff( void )
{
GadToolsBase = (APTR) OpenLibrary( "gadtools.library", 0 );
if ( GadToolsBase == NULL ) {
puts( "Sorry, you need gadtools.library!" );
return( 10L );
}
AslBase = (APTR) OpenLibrary( "asl.library", 0 );
if ( AslBase == NULL ) {
puts( "Sorry, you need asl.library!" );
return( 8l );
}
if ( !( Scr = OpenScreenTagList( 0L, ScreenTags_PAL ))) {
if ( !( Scr = OpenScreenTagList( 0L, ScreenTags_NTSC )))
return( 5L );
}
if ( MakeWindow() != 0L ) {
return( 1l );
}
}
long MakeWindow( void )
{
WindowTags[ 9 ].ti_Data = Scr;
if ( NOT( Wnd = OpenWindowTagList( 0L, WindowTags )))
return( 5l );
MakeDisplay( 0 );
RefreshGList( GList, Wnd, NULL, -1 );
GT_RefreshWindow( Wnd, NULL );
}
long MakeDisplay( int Display_num )
{
struct NewGadget ng;
struct Gadget *g;
BOOL check_flag;
UBYTE *temp_ptr;
TOP_LEVEL_BUF = &TOP_LEVEL_NAME[ 0 ];
IDCMP_WIN_BUF = &IDCMP_WIN_NAME[ 0 ];
PREFIX_BUF = &PREFIX_NAME[ 0 ];
SUFFIX_BUF = &SUFFIX_NAME[ 0 ];
switch ( Display_num ) {
/* making window #0 */
case 0 :
if ( NOT( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2l );
if ( NOT( g = CreateContext( &GList )))
return( 3l );
ng.ng_LeftEdge = 208;
ng.ng_TopEdge = 104;
ng.ng_Width = 208;
ng.ng_Height = 16;
ng.ng_GadgetText = "IDCMPWindow";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_IDCMPWindow;
ng.ng_Flags = PLACETEXT_ABOVE;
ng.ng_VisualInfo = VisualInfo;
g = CreateGadget( STRING_KIND, g, &ng,
GTST_String, IDCMP_WIN_NAME, GTST_MaxChars, 40, TAG_DONE );
IDCMP_WIN_BUF = ((struct StringInfo *) g->SpecialInfo)->Buffer;
Gadgets[ 0 ] = g;
ng.ng_LeftEdge = 184;
ng.ng_TopEdge = 150;
ng.ng_GadgetText = "Class";
ng.ng_GadgetID = GD_Code;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & CLASS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 1 ] = g;
ng.ng_TopEdge = 170;
ng.ng_GadgetText = "Code";
ng.ng_GadgetID = GD_Code;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & CODE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 2 ] = g;
ng.ng_TopEdge = 190;
ng.ng_GadgetText = "Qualifier";
ng.ng_GadgetID = GD_Qualifier;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & QUALIFIER_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 3 ] = g;
ng.ng_LeftEdge = 386;
ng.ng_TopEdge = 150;
ng.ng_GadgetText = "MouseX";
ng.ng_GadgetID = GD_MouseX;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & MOUSEX_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 4 ] = g;
ng.ng_LeftEdge = 501;
ng.ng_GadgetText = "MouseY";
ng.ng_GadgetID = GD_MouseY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & MOUSEY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 5 ] = g;
ng.ng_LeftEdge = 386;
ng.ng_TopEdge = 170;
ng.ng_GadgetText = "Seconds";
ng.ng_GadgetID = GD_Seconds;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & SECONDS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 6 ] = g;
ng.ng_LeftEdge = 501;
ng.ng_GadgetText = "Micros";
ng.ng_GadgetID = GD_Micros;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & MICROS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 7 ] = g;
ng.ng_LeftEdge = 470;
ng.ng_TopEdge = 190;
ng.ng_GadgetText = "IAddress";
ng.ng_GadgetID = GD_IAddress;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag1 & IADDRESS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 8 ] = g;
ng.ng_LeftEdge = 80;
ng.ng_TopEdge = 222;
ng.ng_Width = 100;
ng.ng_Height = 18;
ng.ng_GadgetText = "QUIT";
ng.ng_GadgetID = GD_QUIT1;
ng.ng_Flags = PLACETEXT_IN;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 9 ] = g;
ng.ng_LeftEdge = 460;
ng.ng_TopEdge = 222;
ng.ng_GadgetText = "GO ON";
ng.ng_GadgetID = GD_GO_ON1;
ng.ng_Flags = PLACETEXT_IN;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 10 ] = g;
if ( NOT g )
return( 4l );
AddGList( Wnd, GList, 0, -1, NULL );
Gadgets[ 11 ] = 0;
PrintIText( Wnd->RPort, IText1, 0L, 0L );
DrawImage( Wnd->RPort, &Title, 76L, 30L );
break;
/* making window #1 */
case 1 :
if ( NOT( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2l );
if ( NOT( g = CreateContext( &GList )))
return( 3l );
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 33;
ng.ng_GadgetText = "MOUSEBUTTONS";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_MOUSEBUTTONS;
ng.ng_Flags = PLACETEXT_LEFT;
ng.ng_VisualInfo = VisualInfo;
check_flag = (Flag2A & MOUSEBUTTONS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 0 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_MOUSEBUTTONS_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & MOUSEBUTTONS_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 1 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 45;
ng.ng_GadgetText = "MOUSEMOVE";
ng.ng_GadgetID = GD_MOUSEMOVE;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & MOUSEMOVE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 2 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_MOUSEMOVE_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & MOUSEMOVE_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 3 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 57;
ng.ng_GadgetText = "DELTAMOVE";
ng.ng_GadgetID = GD_DELTAMOVE;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & DELTAMOVE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 4 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_DELTAMOVE_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & DELTAMOVE_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 5 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 77;
ng.ng_GadgetText = "GADGETDOWN";
ng.ng_GadgetID = GD_GADGETDOWN;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & GADGETDOWN_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 6 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_GADGETDOWN_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & GADGETDOWN_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 7 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 89;
ng.ng_GadgetText = "GADGETUP";
ng.ng_GadgetID = GD_GADGETUP;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & GADGETUP_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 8 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_GADGETUP_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & GADGETUP_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 9 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 101;
ng.ng_GadgetText = "CLOSEWINDOW";
ng.ng_GadgetID = GD_CLOSEWINDOW;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & CLOSEWINDOW_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 10 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_CLOSEWINDOW_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & CLOSEWINDOW_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 11 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 121;
ng.ng_GadgetText = "MENUPICK";
ng.ng_GadgetID = GD_MENUPICK;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & MENUPICK_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 12 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_MENUPICK_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & MENUPICK_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 13 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 133;
ng.ng_GadgetText = "MENUVERIFY";
ng.ng_GadgetID = GD_MENUVERIFY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & MENUVERIFY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 14 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_MENUVERIFY_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & MENUVERIFY_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 15 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 145;
ng.ng_GadgetText = "MENUHELP";
ng.ng_GadgetID = GD_MENUHELP;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & MENUHELP_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 16 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_MENUHELP_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & MENUHELP_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 17 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 165;
ng.ng_GadgetText = "RAWKEY";
ng.ng_GadgetID = GD_RAWKEY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & RAWKEY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 18 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_RAWKEY_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & RAWKEY_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 19 ] = g;
ng.ng_LeftEdge = 138;
ng.ng_TopEdge = 177;
ng.ng_GadgetText = "VANILLAKEY";
ng.ng_GadgetID = GD_VANILLAKEY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & VANILLAKEY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 20 ] = g;
ng.ng_LeftEdge = 166;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_VANILLAKEY_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & VANILLAKEY_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 21 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 33;
ng.ng_GadgetText = "REQSET";
ng.ng_GadgetID = GD_REQSET;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & REQSET_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 22 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_REQSET_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & REQSET_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 23 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 45;
ng.ng_GadgetText = "REQCLEAR";
ng.ng_GadgetID = GD_REQCLEAR;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & REQCLEAR_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 24 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_REQCLEAR_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & REQCLEAR_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 25 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 57;
ng.ng_GadgetText = "REQVERIFY";
ng.ng_GadgetID = GD_REQVERIFY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2A & REQVERIFY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 26 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_REQVERIFY_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2A & REQVERIFY_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 27 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 77;
ng.ng_GadgetText = "NEWSIZE";
ng.ng_GadgetID = GD_NEWSIZE;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & NEWSIZE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 28 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_NEWSIZE_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & NEWSIZE_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 29 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 89;
ng.ng_GadgetText = "SIZEVERIFY";
ng.ng_GadgetID = GD_SIZEVERIFY;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & SIZEVERIFY_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 30 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_SIZEVERIFY_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & SIZEVERIFY_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 31 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 101;
ng.ng_GadgetText = "ACTIVEWINDOW";
ng.ng_GadgetID = GD_ACTIVEWINDOW;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & ACTIVEWINDOW_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 32 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_ACTIVEWINDOW_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & ACTIVEWINDOW_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 33 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 113;
ng.ng_GadgetText = "INACTIVEWINDOW";
ng.ng_GadgetID = GD_INACTIVEWINDOW;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & INACTIVEWINDOW_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 34 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_INACTIVEWINDOW_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & INACTIVEWINDOW_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 35 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 125;
ng.ng_GadgetText = "CHANGEWINDOW";
ng.ng_GadgetID = GD_CHANGEWINDOW;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & CHANGEWINDOW_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 36 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_CHANGEWINDOW_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & CHANGEWINDOW_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 37 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 137;
ng.ng_GadgetText = "REFRESHWINDOW";
ng.ng_GadgetID = GD_REFRESHWINDOW;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & REFRESHWINDOW_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 38 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_REFRESHWINDOW_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & REFRESHWINDOW_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 39 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 157;
ng.ng_GadgetText = "DISKINSERTED";
ng.ng_GadgetID = GD_DISKINSERTED;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & DISKINSERTED_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 40 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_DISKINSERTED_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & DISKINSERTED_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 41 ] = g;
ng.ng_LeftEdge = 356;
ng.ng_TopEdge = 169;
ng.ng_GadgetText = "DISKREMOVED";
ng.ng_GadgetID = GD_DISKREMOVED;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & DISKREMOVED_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 42 ] = g;
ng.ng_LeftEdge = 384;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_DISKREMOVED_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & DISKREMOVED_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 43 ] = g;
ng.ng_LeftEdge = 541;
ng.ng_TopEdge = 65;
ng.ng_GadgetText = "NEWPREFS";
ng.ng_GadgetID = GD_NEWPREFS;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & NEWPREFS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 44 ] = g;
ng.ng_LeftEdge = 569;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_NEWPREFS_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & NEWPREFS_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 45 ] = g;
ng.ng_LeftEdge = 541;
ng.ng_TopEdge = 85;
ng.ng_GadgetText = "INTUITICKS";
ng.ng_GadgetID = GD_INTUITICKS;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & INTUITICKS_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 46 ] = g;
ng.ng_LeftEdge = 569;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_INTUITICKS_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & INTUITICKS_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 47 ] = g;
ng.ng_LeftEdge = 541;
ng.ng_TopEdge = 105;
ng.ng_GadgetText = "IDCMPUPDATE";
ng.ng_GadgetID = GD_IDCMPUPDATE;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & IDCMPUPDATE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 48 ] = g;
ng.ng_LeftEdge = 569;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_IDCMPUPDATE_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & IDCMPUPDATE_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 49 ] = g;
ng.ng_LeftEdge = 541;
ng.ng_TopEdge = 190;
ng.ng_GadgetText = "LONELYMESSAGE";
ng.ng_GadgetID = GD_LONELYMESSAGE;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag2B & LONELYMESSAGE_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 50 ] = g;
ng.ng_LeftEdge = 569;
ng.ng_GadgetText = "F";
ng.ng_GadgetID = GD_LONELYMESSAGE_F;
ng.ng_Flags = PLACETEXT_RIGHT;
check_flag = (Flag2B & LONELYMESSAGE_F_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 51 ] = g;
ng.ng_LeftEdge = 80;
ng.ng_TopEdge = 222;
ng.ng_Width = 100;
ng.ng_Height = 18;
ng.ng_GadgetText = "QUIT";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_QUIT2;
ng.ng_Flags = PLACETEXT_IN;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 52 ] = g;
ng.ng_LeftEdge = 460;
ng.ng_GadgetText = "GO ON";
ng.ng_GadgetID = GD_GO_ON2;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 53 ] = g;
ng.ng_LeftEdge = 324;
ng.ng_GadgetText = "STEP BACK";
ng.ng_GadgetID = GD_STEP_BACK2;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 54 ] = g;
if ( NOT g )
return( 4l );
AddGList( Wnd, GList, 0, -1, NULL );
PrintIText( Wnd->RPort, IText2, 0L, 0L );
break;
/* making window #2 */
case 2 :
if ( NOT( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2l );
if ( NOT( g = CreateContext( &GList )))
return( 3l );
ng.ng_LeftEdge = 44;
ng.ng_TopEdge = 53;
ng.ng_Width = 208;
ng.ng_Height = 16;
ng.ng_GadgetText = "top-level function";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_TopLevelName;
ng.ng_Flags = PLACETEXT_ABOVE;
ng.ng_VisualInfo = VisualInfo;
g = CreateGadget( STRING_KIND, g, &ng, GTST_String, TOP_LEVEL_NAME,
GTST_MaxChars, 40, TAG_DONE );
TOP_LEVEL_BUF = ((struct StringInfo *) g->SpecialInfo)->Buffer;
Gadgets[ 0 ] = g;
ng.ng_LeftEdge = 36;
ng.ng_TopEdge = 92;
ng.ng_Width = 146;
ng.ng_GadgetText = "prefix";
ng.ng_GadgetID = GD_Prefix;
g = CreateGadget( STRING_KIND, g, &ng, GTST_String, PREFIX_NAME,
GTST_MaxChars, 20, TAG_DONE );
PREFIX_BUF = ((struct StringInfo *) g->SpecialInfo)->Buffer;
Gadgets[ 1 ] = g;
ng.ng_LeftEdge = 194;
ng.ng_TopEdge = 92;
ng.ng_GadgetText = "suffix";
ng.ng_GadgetID = GD_Suffix;
g = CreateGadget( STRING_KIND, g, &ng, GTST_String, SUFFIX_NAME,
GTST_MaxChars, 20, TAG_DONE );
SUFFIX_BUF = ((struct StringInfo *) g->SpecialInfo)->Buffer;
Gadgets[ 2 ] = g;
ng.ng_LeftEdge = 266;
ng.ng_TopEdge = 137;
ng.ng_GadgetText = "function skeletons";
ng.ng_GadgetID = GD_Skeletons;
ng.ng_Flags = PLACETEXT_LEFT;
check_flag = (Flag3 & Skeletons_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 3 ] = g;
ng.ng_TopEdge = 157;
ng.ng_GadgetText = "function prototypes";
ng.ng_GadgetID = GD_Prototypes;
check_flag = (Flag3 & Prototypes_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 4 ] = g;
ng.ng_TopEdge = 177;
ng.ng_GadgetText = "gadtools.library";
ng.ng_GadgetID = GD_Prototypes;
check_flag = (Flag3 & gadtools_FLAG) ? TRUE : FALSE;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked,
check_flag, TAG_DONE );
Gadgets[ 5 ] = g;
ng.ng_LeftEdge = 390;
ng.ng_TopEdge = 53;
ng.ng_Width = 215;
ng.ng_Height = 14;
ng.ng_GadgetText = " waiting";
ng.ng_GadgetID = GD_WaitingMode;
ng.ng_Flags = PLACETEXT_ABOVE;
switch (WaitingMode_FLAG) {
case 0:
temp_ptr = WaitingModeLabels0;
WaitingMode_START = 0;
break;
case 1:
temp_ptr = WaitingModeLabels1;
WaitingMode_START = 1;
break;
}
g = CreateGadget( CYCLE_KIND, g, &ng, GTCY_Labels, temp_ptr, TAG_DONE );
Gadgets[ 6 ] = g;
ng.ng_TopEdge = 98;
ng.ng_GadgetText = " variables";
ng.ng_GadgetID = GD_Variables;
switch (Variables_FLAG) {
case 0:
temp_ptr = VariablesLabels0;
Variables_START = 0;
break;
case 1:
temp_ptr = VariablesLabels1;
Variables_START = 1;
break;
}
g = CreateGadget( CYCLE_KIND, g, &ng, GTCY_Labels, temp_ptr, TAG_DONE );
Gadgets[ 7 ] = g;
ng.ng_TopEdge = 143;
ng.ng_GadgetText = " comments";
ng.ng_GadgetID = GD_Comments;
switch (Comments_FLAG) {
case 0:
temp_ptr = CommentsLabels0;
Comments_START = 0;
break;
case 1:
temp_ptr = CommentsLabels1;
Comments_START = 1;
break;
case 2:
temp_ptr = CommentsLabels2;
Comments_START = 2;
break;
}
g = CreateGadget( CYCLE_KIND, g, &ng, GTCY_Labels, temp_ptr, TAG_DONE );
Gadgets[ 8 ] = g;
ng.ng_TopEdge = 188;
ng.ng_GadgetText = " fill-ins";
ng.ng_GadgetID = GD_FillIns;
switch (FillIns_FLAG) {
case 0:
temp_ptr = FillInsLabels0;
FillIns_START = 0;
break;
case 1:
temp_ptr = FillInsLabels1;
FillIns_START = 1;
break;
case 2:
temp_ptr = FillInsLabels2;
FillIns_START = 2;
break;
case 3:
temp_ptr = FillInsLabels3;
FillIns_START = 3;
break;
}
g = CreateGadget( CYCLE_KIND, g, &ng, GTCY_Labels, temp_ptr, TAG_DONE );
Gadgets[ 9 ] = g;
ng.ng_LeftEdge = 80;
ng.ng_TopEdge = 222;
ng.ng_Width = 100;
ng.ng_Height = 18;
ng.ng_GadgetText = "QUIT";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_QUIT3;
ng.ng_Flags = PLACETEXT_IN;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 10 ] = g;
ng.ng_LeftEdge = 460;
ng.ng_GadgetText = "WRITE C";
ng.ng_GadgetID = GD_WRITE_C;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 11 ] = g;
ng.ng_LeftEdge = 324;
ng.ng_GadgetText = "STEP BACK";
ng.ng_GadgetID = GD_STEP_BACK3;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
Gadgets[ 12 ] = g;
if ( NOT g )
return( 4l );
AddGList( Wnd, GList, 0, -1, NULL );
Gadgets[ 13 ] = 0;
PrintIText( Wnd->RPort, IText3, 0L, 0L );
break;
}
RefreshGadgets( GList, Wnd, NULL );
GT_RefreshWindow( Wnd, NULL );
}
void CleanStuff( void )
{
if ( Wnd )
CloseWindow( Wnd );
if ( GList )
FreeGadgets( GList );
if ( VisualInfo )
FreeVisualInfo( VisualInfo );
if ( Scr )
CloseScreen( Scr );
}